package net.test.piggy.component;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "temp-direct-queue")
public class RabbitMessageHandler {

    Logger logger = LoggerFactory.getLogger(RabbitMessageHandler.class);

    @RabbitHandler
    public void receiveMessageTemp(Object object){
        Message message = (Message) object;
        byte[] body = message.getBody();
        String info = new String(body);
        logger.info(" receive temp-direct-queue message --> {}",info);
    }
}
